<template>
	<view>
		<!-- 通过组件事件名来触发事件，接收值 -->
		<user-emit45 @add="onAdd" @fontsizefn="setfontsize"></user-emit45>
	</view>
	<view class="box" :style="{background:color,fontSize:size+'px'}">
		盒子
	</view>
</template>

<script setup>
import { ref } from 'vue';
const color = ref("#ccc");
const size = ref(16);
function onAdd(e){
	color.value = "#" + String(e).substring(3,6);
}
function setfontsize(e){
	size.value = e
}	
</script>

<style lang="scss" scoped>
.box {
	height: 200px;
	border: 1px solid pink;
	background-color: #fff;
}     
</style>
